<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./js/index.js"></script>
  </head>
  <body>
    12121
    <script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
    <script>
      console.log($);
      // function requestData() {
      //   const xmlRequest = new XMLHttpRequest();
      //   xmlRequest.open(
      //     "GET",
      //     "http://10.1.2.127:8101/sysResourceApply/getSysResourceChildApplyInfo?id=49",
      //     true
      //   );
      //   xmlRequest.setRequestHeader("content-type", "application/json");
      //   xmlRequest.send(null);
      //   xmlRequest.onreadystatechange = function (e) {
      //     if (xmlRequest.readyState == 4 && xmlRequest.status == 200) {
      //       console.log(e, 12);
      //     } else {
      //       console.log("失败了");
      //     }
      //   };
      // }
      // requestData();
      // function req() {
      //   $.get(
      //     "http://10.1.2.127:8101/sysResourceApply/getSysResourceChildApplyInfo?id=49",
      //     function (data, status) {
      //       console.log(data);
      //     }
      //   );
      // }
      const data = {
        id: 49,
      };
      $.ajax({
        url: "http://10.1.2.127:8101/sysResourceApply/getSysResourceChildApplyInfo",
        data: data,
        dataType: "jsonp",
        cache: false,
        timeout: 5000,
        // jsonp 字段含义为服务器通过什么字段获取回调函数的名称
        jsonp: "callback",
        // 声明本地回调函数的名称，jquery 默认随机生成一个函数名称
        jsonpCallback: "jsonpCallback",
        success: function (data) {
          console.log("ajax success callback: " + data.name);
        },
        error: function (jqXHR, textStatus, errorThrown) {
          console.log(textStatus + " " + errorThrown);
        },
      });
      // req();
    </script>
  </body>
</html>
